package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.RepairOrder;
import cn.gson.crm.model.pojos.RepairPayment;
import cn.gson.crm.model.service.RepairPaymentService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/RepairPaymentController")
public class RepairPaymentController {
    @Autowired
    RepairPaymentService repairPaymentService;
    @RequestMapping("/ContractMethod")
    @ResponseBody
    //查询当前登录人所经手的维修回款
    public Map<String,Object> selectpaymen(HttpSession session,Integer rid, Integer page, Integer size){

        return repairPaymentService.selectpaymen(session,rid,page,size);
    };
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    //多条件查询维修回款
    public Map<String,Object> selectwhere(HttpSession session, Integer rid, String where, Integer page, Integer size){

        return repairPaymentService.selectwhere(session,rid,where,page,size);
    };
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    //时间查询维修回款
    public  Map<String,Object> selecttime(HttpSession session,Integer rid, String statr,String endtime,Integer page,Integer size){
        return repairPaymentService.selecttime(session,rid,statr,endtime,page,size);

    };
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    //修改工单回款钱
    public void updatemoney(Integer money,Integer rid){
        repairPaymentService.updatemoney(money,rid);
    };
    @RequestMapping("/ContractMethod5")
    @ResponseBody
    //修改工单回款状态
    public void updatestate(Integer rid){
        repairPaymentService.updatestate(rid);
    };
    @RequestMapping("/ContractMethod6")
    @ResponseBody
    //新增
    public void save(@RequestBody RepairPayment repairPayment){
        repairPaymentService.save(repairPayment);
    }
    @RequestMapping("/ContractMethod7")
    @ResponseBody
    //根据客户查出维修工单
    public List<RepairOrder> selecteweixu(Integer cid){
        return repairPaymentService.selecteweixu(cid);
    };
}
